package com.lee.interview;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @author L+ 集合求交集和并集
 */
public class CollectionTest {
	public static final int LIST_SIZE = 10;

	public static void main(String[] args) {
		List<String> list1 = new ArrayList<String>();
		List<String> list2 = new ArrayList<String>();
		for (int i = 0; i < LIST_SIZE; i++) {
			list1.add(i + "");
		}
		printListData(list1);
		for (int i = 5; i < 5 + LIST_SIZE; i++) {
			list2.add(i + "");
		}
		printListData(list2);
		list1.removeAll(list2);
		list1.addAll(list2);
		printListData(list1);
	}

	public static void printListData(List<String> list) {
		System.out.println("======List数据：=====");
		for (String string : list) {
			System.out.print(string + "	");
		}
		System.out.println();
	}
}
